<?php 

require('inc/db.php');

$sort = $_GET['sort'];

// 组装插入sql
$sql = "select * from article where sort='$sort' order by created desc limit 0, 15";

// 执行mysql查询
$result = mysql_query($sql, $conn);


?>

<?php include('header.php'); ?>

<div class="wrapper">
	<div class="main">
		<div class="bcl">
    		<div class="title">新闻中心</div>
            <div class="kuang">
            	<ul>
                	<li><a href="news_list.php?sort=kaiye">凯业新闻</a></li>  
      			  	<li><a href="news_list.php?sort=fagui">政策法规</a></li>
              	  	<li><a href="news_list.php?sort=hangye">行业新闻</a></li>
      			</ul>
            </div>
        </div>
        
        <div class="main_right">
    		<div class="title">凯业新闻</div>
        	<div class="news_list">
          		<ul>
          		<?php 
          		for($i=0; $i<mysql_num_rows($result); $i++) {
					$article = mysql_fetch_assoc( $result );
				?>
            		<li>
            			<a href="news.php?id=<?php echo $article['id'] ?>"><?php echo $article['title'] ?></a>
            			<span class="date">[<?php echo $article['created'] ?>]</span>
            		</li>
            	<?php 
          		}
            	?>
          		</ul>
        	</div>
     	</div>
	</div>
</div>

<?php include('footer.php'); ?>
